package com.example.wnn.config.base;

import lombok.Data;

@Data
public class ResultVo {
    private String code;
    private String msg;
    private Object obj;

    //返回错误构造方法
    public static ResultVo build() {
        return new ResultVo();
    }

    public static ResultVo ok(String msg, Object obj) {
        return new ResultVo("200", msg, obj);
    }

    public static ResultVo ok(String msg) {
        return new ResultVo("200", msg, null);
    }

    public static ResultVo error(String code , String msg, Object obj) {
        return new ResultVo(code, msg, obj);
    }

    public static ResultVo error(String msg, Object obj) {
        return new ResultVo("500", msg, obj);
    }

    public static ResultVo error(String msg) {
        return new ResultVo("500", msg, null);
    }

    public ResultVo() {
    }

    public ResultVo(String code, String msg, Object obj) {
        this.code = code;
        this.msg = msg;
        this.obj = obj;
    }
}
